import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/user/user/loginByPassword',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/user/user/getUserByToken',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/user/user/logout',
    method: 'post'
  })
}

export function getUserPage(query) {
  return request({
      url: "admin/user/page",
      method: "get",
      params: query
  })
}

export function deleteUserByIds(ids) {
  return request({
      url: `admin/user/delete/${Array.isArray(ids) ? ids.join(',') : ids}`,
      method: "delete"
  })
}

export function enableUser(ableParam) {
  return request({
      url: "admin/user/able",
      method: "put",
      data:ableParam
  })
}
